package com.education.welco.controller;


import com.education.common.utils.ApiReturnObject;
import com.education.welco.feign.SVideoRecordFeign;
import com.education.welco.service.ISCatalogMenuService;
import com.education.welco.service.ISTheoryClassroomService;
import com.education.welco.service.ISTheoryPartekeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/lResources")
public class MyTeachingController {

    /**
     * 教学  我的课程   参与课程  预约录制   录播视频
     */
    @Autowired
    private ISTheoryClassroomService theoryClassroomService;
    @Autowired
    private ISTheoryPartekeService theoryPartekeService;
    @Autowired
    private ISCatalogMenuService catalogMenuService;
    @Autowired
    private SVideoRecordFeign recordFeign;

    @GetMapping("/count")
    public ApiReturnObject count(Integer userId) {
        HashMap<String, Object> map = new HashMap<>();
        if (userId != null) {
            //智慧课堂
            Integer classroomCount = theoryClassroomService.selectSTheoryClassroomCount(userId);
            //参与课程数
            Integer partekeCount = theoryPartekeService.selectSTheoryPartekeCount(userId);
            //我的课程总数
            Integer menuCount = catalogMenuService.selectSCatalogMenuCount(userId);
            //我的资源 count
            int videoCount = recordFeign.videoCount(userId);
            map.put("classroomCount", classroomCount);
            map.put("partekeCount", partekeCount);
            map.put("menuCount", menuCount);
            map.put("recVideoCount", videoCount);
            return new ApiReturnObject("200", "查询成功", map);
        }
        return new ApiReturnObject("201", "缺少userId", "");
    }


}
